package view;

import java.awt.event.ActionListener;
import javax.swing.JButton;
import java.awt.Window.Type;
import javax.swing.JFrame;

/**
 * The Class UpdatePhotoLayersGUI.
 * @author Dmitry & Tomer
 */
public class UpdatePhotoLayersGUI extends AbstractGUI 
{
	
	/** The button add new layer. */
	private JButton btnAddNewLayer = null;
	
	/** The button edit existing layers. */
	private JButton btnEditExistingLayers = null;
	
	
	/**
	 * Instantiates a new update photo layers GUI.
	 */
	public UpdatePhotoLayersGUI() {
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		getContentPane().setLayout(null);
		getContentPane().add(getBtnAddNewLayer());
		getContentPane().add(getBtnEditExistingLayers());
		
		backButton = new JButton("Back");
		backButton.setBounds(207, 136, 115, 29);
		getContentPane().add(backButton);
		
		this.setTitle("Update Photo Layers");
		this.setVisible(true);
		this.setResizable(false);
		this.setBounds(200, 200, 365, 220);
	}
	
	
	/**
	 * Gets the button add new layer.
	 *
	 * @return the button add new layer
	 */
	private JButton getBtnAddNewLayer(){
		if(btnAddNewLayer == null){
			btnAddNewLayer = new JButton("Add New Layer");
			btnAddNewLayer.setBounds(30, 16, 292, 44);
		}
		return btnAddNewLayer;
	}

	/**
	 * Gets the button edit existing layers.
	 *
	 * @return the button edit existing layers
	 */
	private JButton getBtnEditExistingLayers(){
		if(btnEditExistingLayers == null){
			btnEditExistingLayers = new JButton("Edit Existing Layers");
			btnEditExistingLayers.setBounds(30, 76, 292, 44);
		}
		return btnEditExistingLayers;
	}
	
	/**
	 * Adds the "add new layer" button an action listener.
	 *
	 * @param listener the listener
	 */
	public void addAddNewLayerActionListener(ActionListener listener){
		getBtnAddNewLayer().addActionListener(listener);
	}
	
	/**
	 * Adds the "edit existing layers" button an action listener.
	 *
	 * @param listener the listener
	 */
	public void addEditExistingLayersActionListener(ActionListener listener)
	{
		getBtnEditExistingLayers().addActionListener(listener);
	}
	
	/**
	 * Enables or disables the edit button , and it's visibility.
	 *
	 * @param b a boolean variable. <br>
	 * true - enable.
	 * false - disable.
	 */
	public void enableEditButton(boolean b)
	{
		getBtnEditExistingLayers().setEnabled(b);
		getBtnEditExistingLayers().setVisible(b);
	}
}
